package Regex;

public class Practice2 {
    public static void main(String[] args) {
        //判断用户名
        String name="\\w{4,16}";
        System.out.println("dfs324_".matches(name));
        System.out.println("/{]|24_".matches(name));

        //判断身份证
        String id="\\d{1,17}[0-9Xx]";
        System.out.println("445122200212210971".matches(id));
        System.out.println("351531frg4q43".matches(id));

        //身份证严格要求
        String idplas="^[1-9]\\d{5}(19\\d{2}|2\\d{3})((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}(\\d|x|X)$";
        System.out.println("445122200212210971".matches(idplas));
    }
}
